package tbdp.tool.container;

import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import tbdp.tool.spi.Writer;

/**
 * @author xbkaishui
 * @version $Id: ProcessorContainer.java, v 0.1 2017-06-17 下午4:18 xbkaishui Exp $$
 */
public class WriterContainer {

    public static Map<String, Writer> writerContainer = new ConcurrentHashMap<String, Writer>();

    public static void addWriter(Writer writer) {
        writerContainer.putIfAbsent(writer.getType(), writer);
    }

    public static Writer getWriter(String type) {
        return writerContainer.get(type);
    }

    public static Map<String, Writer> getWriterContainer() {
        return Collections.unmodifiableMap(writerContainer);
    }
}
